<template>
	<view>
		<u-loading-page :loading="loadding" loading-mode="semicircle" loading-text="加载中"></u-loading-page>
		<view class="data_box" v-if="!loadding">
			<!-- 交易 -->
			<view class="data_list">
				<view class="data_tit">
					<view class="tit">
						<u-icon name="order" color="#2979ff" size="28"></u-icon>
						<text>交易数据</text>
					</view>
					<view class="tags">
						<text>本月</text>
					</view>
				</view>
				<view class="data_month_total">
					<view class="items" @click="tranDataInfo(1)">
						<view class="tops">
							<text>{{data.tran.self_total}}</text>
							<text v-if="data.tran.self_month_tit != ''" class="tits">({{data.tran.self_month_tit}})</text>
						</view>
						<view class="bottoms">
							<text>我的</text>
						</view>
					</view>
					<view class="items" @click="tranDataInfo(2)">
						<view class="tops">
							<text>{{data.tran.team_total}}</text>
							<text v-if="data.tran.team_month_tit != ''" class="tits">({{data.tran.team_month_tit}})</text>
						</view>
						<view class="bottoms">
							<text>团队</text>
						</view>
					</view>
				</view>
				<view class="data_end">
					<view class="total-title">
						<u-icon name="red-packet" size="20"></u-icon>
						<text style="color: #000000;">合计交易额</text>
					</view>
					<text class="total">{{data.tran.all_total}}</text>
				</view>
			</view>
			<!-- 激活 -->
			<view class="data_list">
				<view class="data_tit">
					<view class="tit">
						<u-icon name="/static/terminal.png" color="#2979ff" size="28"></u-icon>
						<text>激活数据</text>
					</view>
					<view class="tags">
						<text>本月</text>
					</view>
				</view>
				<view class="data_month_total">
					<view class="items" @click="activeDataInfo(1)">
						<view class="tops">
							<text>{{data.active.self_total}}</text>
							<text v-if="data.active.self_month_tit != ''" class="tits">({{data.active.self_month_tit}})</text>
						</view>
						<view class="bottoms">
							<text>我的</text>
						</view>
					</view>
					<view class="items" @click="activeDataInfo(2)">
						<view class="tops">
							<text>{{data.active.team_total}}</text>
							<text v-if="data.active.team_month_tit != ''" class="tits">({{data.active.team_month_tit}})</text>
						</view>
						<view class="bottoms">
							<text>团队</text>
						</view>
					</view>
				</view>
				<view class="data_end">
					<view class="total-title">
						<u-icon name="calendar" size="20"></u-icon>
						<text style="color: #000000;">总激活(台)</text>
					</view>
					<text class="total">{{data.active.all_total}}</text>
				</view>
			</view>
			<!-- 团队 -->
			<view class="data_list">
				<view class="data_tit">
					<view class="tit">
						<u-icon name="/static/teams.png" color="#2979ff" size="28"></u-icon>
						<text>团队数据</text>
					</view>
				</view>
				<view class="data_end bottom_line" style="padding-bottom: 24rpx" @click="team(1)">
					<text style="color: #000000;">我的直营(人)</text>
					<text class="total">{{data.team.month}}</text>
				</view>
				<view class="data_end" style="padding-top: 24rpx" @click="team(2)">
					<text style="color: #000000;">团队总数(人)</text>
					<text class="total">{{data.team.total}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				loadding: true,
				data: {
					tran: {},
					team: {},
					active: {},
				},
			}
		},
		onShow() {
			this._list()
		},
		methods: {
			//页面数据
			async _list() {
				uni.showLoading({
					title: '加载中'
				});
				const {
					data: res
				} = await this.$myHttp({
					url: 'v1/getHzyDataTotalData',
				});
				uni.hideLoading()
				this.loadding = false
				if (res.code == 200) {
					this.data.tran = res.data.tran
					this.data.team = res.data.team
					this.data.active = res.data.active
				}
			},
			tranDataInfo(e) {
				uni.navigateTo({
					url: '/pages/hzy/data/trade/index'
				})
			},
			activeDataInfo(e) {
				uni.navigateTo({
					url: '/pages/hzy/data/active/index'
				})
			},
			//团队
			team(type) {
				uni.navigateTo({
					url: '/pages/data/team/team?type=' + type
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	page {
		background-color: #F2F6FC;
	}
	.data_box {
		padding: 30rpx;

		.data_list {
			background-color: #fff;
			box-sizing: border-box;
			margin-bottom: 30rpx;
			border-radius: 15rpx;
			box-shadow: 7px 0px 30px -18px #909399;
			padding-bottom: 20rpx;
			border-radius: 8rpx;

			.data_tit {
				padding: 30rpx;
				padding-right: 0;
				border-bottom: #eee 1px solid;
				display: flex;
				align-items: center;
				justify-content: space-between;

				.tit {
					display: flex;
					justify-content: center;
					
					text {
						font-size: 32rpx;
						position: relative;
						padding-left: 10rpx;
						font-weight: bold;
					}

					// text::before {
					// 	position: absolute;
					// 	content: '';
					// 	height: 90%;
					// 	margin-top: 2%;
					// 	width: 10rpx;
					// 	background-color: #2f9fff;
					// 	border-radius: 30rpx;
					// 	left: 0;
					// }
				}
				
				.tags {
					padding-right: 30rpx;
					font-size: 32rpx;
					font-weight: bold;
					color: #2f9fff;
				}

				.end {
					font-size: 28rpx;
					background-image: linear-gradient(#2f9fff, #5999ff);
					padding: 10rpx 30rpx;
					border-top-left-radius: 30rpx;
					border-bottom-left-radius: 10rpx;
					color: #fff;
				}
			}

			.data_cont {
				display: flex;
				flex-direction: column;
				padding: 30rpx;
				justify-content: space-around;
				padding-top: 0;
				border-bottom: #eee 1px solid;
				text-align: end;
				
				.data_cont_end {
					display: flex;
					justify-content: space-between;
				}

				text {
					
					font-size: 32rpx;
					color: #2f9fff;
					display: block;
					margin-top: 20rpx;
					
				}

				.h4 {
					font-size: 28rpx;
					width: fit-content;
					color: #999;
					text-align: left;
					border-bottom: #eee solid 0px;
					
				}

				view:last-child {
					border: none;
					padding-bottom: 0;
				}
			}

			.data_end {
				display: flex;
				padding: 10rpx 30rpx;
				padding-top: 20rpx;
				color: #ff7307;
				font-size: 28rpx;
				align-items: center;
				justify-content: space-between;
				line-height: 40rpx;
				
				.total-title {
					display: flex;
					
					text {
						padding-left: 6rpx;
					}
				}

				.total {
					font-weight: bold;
					font-size: 32rpx;
				
				}
			}
			
			.data_month_total {
				padding: 30rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				text-align: center;
				border-bottom: #eee 1px solid;
				
				.items {
					width: 50%;
					.tops {
						font-size: 38rpx;
						
						text {
							color: #2f9fff;
							font-weight: bold;
						}
						
						.tits {
							font-size: 24rpx;
							padding-left: 10rpx;
							color: #999;
						}
					}
					
					.bottoms {
						padding-top: 20rpx;
						padding-bottom: 10rpx;
					}
				}
				
				.items:nth-child(1) {
					border-right: 1px solid #e6e6e6;
				}
				
				.rights {
					width: 50%;
				}
			}
		}
	
		.data_list:nth-child(1) {
			.data_tit {
				background-color: #ecf5ff;
			}
		}
		
		.data_list:nth-child(2) {
			.data_tit {
				background-color: #fef0f0;
			}
		}
		
		.data_list:nth-child(3) {
			.data_tit {
				background-color: #dbf1e1;
			}
		}
	}

	.bottom_line {
		border-bottom: 1px dashed #eee;
	}
</style>